#include <stdio.h>
#include <rt_misc.h>
#include "serial.h"

#pragma import(__use_no_semihosting_swi)


struct __FILE { int handle; };
FILE __stdout;
FILE __stdin;

int fputc(int ch, FILE *f) {
  return (sendchar(ch));
}

int fgetc(FILE *f) {
  return (getkey());
}

int ferror(FILE *f) {
  return EOF;
}

void _ttywrch(int ch) {
  sendchar(ch);
}


void _sys_exit(int return_code) {
label:  goto label; 
}
